function [x,y,z] = stateToGround(s,x1,x2,x3,y1)

% y is fixed, just a real number
% x1,x2,x3,y1 are the mid points of the 3 boards resp.
% s is an m-vector

m = size(s,1);
x = zeros(m,1);
z = ones(m,1);
y = zeros(m,1);

for i=1:m
    y(i)  = y1;
    if(s(i) == 1)
        x(i) = x1;
    elseif(s(i) == 2)
        x(i) = 1;
        z(i) = 2;
    elseif(s(i) == 3)
        x(i) = x2;
    elseif(s(i) == 4)
        x(i) = x2;
        z(i) = 2;
    elseif(s(i) == 5)
        x(i) = x3;
    elseif(s(i) == 6)
        x(i) = x3;
        z(i) = 2;
    end
end

end